using System;
using System.Collections.Generic;
using System.Text;

namespace Zsa.Emulation.Render
{
    /// <summary>
    /// Used to query render capabilities and 
    /// create render settings.
    /// </summary>
    public abstract class RenderDeviceCapabilities<TCaps, TDeviceSettings, TRenderBase>
        where TDeviceSettings : RenderDeviceSettings<TCaps, TDeviceSettings, TRenderBase>
        where TRenderBase : RenderDevice<TCaps, TDeviceSettings, TRenderBase>
        where TCaps : RenderDeviceCapabilities<TCaps, TDeviceSettings, TRenderBase>
    {

        #region Fields
        /// <summary>
        /// The maximum number of instances of the device that can be 
        /// created and used at one time.
        /// </summary>
        private int _MaxInstanace;

        /// <summary>
        /// The render device type.
        /// </summary>
        private RenderDeviceType _DeviceType;
        #endregion Fields

        #region Constructor
        /// <summary>
        /// Initializes a new instance of the <see cref="T:RenderDeviceCapabilities"/> class.
        /// </summary>
        /// <param name="deviceType">Type of the device.</param>
        /// <param name="maxInstance">The max instance.</param>
        protected internal RenderDeviceCapabilities(RenderDeviceType deviceType,
            int maxInstance)
        {
            _DeviceType = deviceType;
            _MaxInstanace = maxInstance;
        }
        #endregion Constructor

        #region Properties
        /// <summary>
        /// Gets the max instance of the device that can be used at one time.
        /// </summary>
        /// <value>The max instance.</value>
        public int MaxInstance
        {
            get
            {
                return _MaxInstanace;
            }
        }
        /// <summary>
        /// Gets the default device.
        /// </summary>
        public abstract RenderDeviceItem DefaultDevice { get;}

        /// <summary>
        /// The default settings.
        /// </summary>
        /// <value>The default settings.</value>
        public virtual TDeviceSettings DefaultSettings
        {
            get
            {
                return this.CreateSettings(DefaultDevice);
            }
        }
        #endregion Properties

        #region Methods
        /// <summary>
        /// Creates the settings for the item.
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        public abstract TDeviceSettings CreateSettings(RenderDeviceItem item);

        /// <summary>
        /// Gets the devices supported by the render.
        /// </summary>
        /// <returns></returns>
        public abstract IList<RenderDeviceItem> GetDevices();
        #endregion Methods

    }
}
